<div>
    <fieldset>
        <legend>Пользователи</legend>

        <div class="PageMenu">
            <button id="AddUserA">Добавить</button>
            <?php echo $this->UserTypes("UserType")->ToHtml(); ?>
            <?php echo $this->FieldType()->ToHtml(); ?>
            <input type="text" id="FieldValue"/>
        </div>

        <div><?php echo $this->UserListSwitch(); ?></div>
    </fieldset>

    <script type="text/javascript">

        jsun("#AddUserA").jsun.event({ onclick: AddUser });
        jsun("#UserType").jsun.event({ onchange: FindUser });
        jsun("#FieldType").jsun.event({ onchange: ChangeType });
        jsun("#FieldValue").jsun.event({ onkeyup: FindUser });

        var pref = "UserList",
            param = "u=Admin&m=Admin\\User/ListPage";

        function AddUser() {
            var dlg = new jsun.dialog({ title: "Новый пользователь"});
            jsun.html.insert(dlg.content.v, jsun.html.sync_load("u=Admin&m=Admin\\User/Add"))
            return dlg.show();
        }

        function ChangeType() {
            if (jsun("#FieldValue").value) FindUser();
        }

        function FindUser() {
            jsun.swap[pref].Page = 1;
            jsun.swap[pref].Req = param + jsun.page.get_data();
            jsun.swap[pref].Start();
        }

        FindUser();

    </script>

</div>